<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<title>邀请好友</title>
	</head>

	<body>
		<div id="app">
			<div v-if="is_weixin_type">{{text}}</div>
			<!-- <div v-else></div> -->
		</div>
	</body>
	<script src="https://cdn.bootcss.com/vue/2.6.11/vue.js"></script>

	<script>
		new Vue({
			el: '#app',
			data() {
				return {
					text: '请点击右上角三个点，选择在默认浏览器打开',
					is_weixin_type: false
				}
			},
			created() {
				this.is_weixin_type = this.is_weixin()
			},
			mounted() {
				var query = this.GetRequest()
				window.location.href = "zykj://" + query.userId || 0;
			},
			methods: {
			// 获取参数
				GetRequest() {
				  var url = location.search; //获取url中"?"符后的字串
				   var theRequest = new Object();
				   if (url.indexOf("?") != -1) {
				      var str = url.substr(1);
				      strs = str.split("&");
				      for(var i = 0; i < strs.length; i ++) {
				         theRequest[strs[i].split("=")[0]]=(strs[i].split("=")[1]);
				      }
				   }
				   return theRequest;
				},
				// 判断微信内置浏览器
				is_weixin(){
					var ua = navigator.userAgent.toLowerCase();
					if(ua.match(/MicroMessenger/i)=="micromessenger") {
						return true;
				 	} else {
						return false;
					}
				}
			}
		});
	</script>

</html>
